use HorseRaceTracker
go

create table Country (
	CountryCode varchar (3)  Primary key ,
	Country varchar (100)  NOT NULL 
)
go


create table Trainer (
	TrainerId uniqueidentifier  primary key ,
	FirstName varchar (100)  NOT NULL ,
	LastName varchar (100)  NOT NULL 
)
GO

create table Horse
(
	HorseId uniqueidentifier  NOT NULL ,
	HorseName varchar (100)  NOT NULL ,
	BredIn varchar (3)  NOT NULL references Country (CountryCode) ,
	Sex char (1)  NOT NULL ,
	Birthyear smallint NOT NULL ,
	Trainer uniqueidentifier  NULL references Trainer (TrainerId) 
)
go

create unique index HorseUK on Horse (HorseName, BredIn)
Go